home *** CD-ROM | disk | FTP | other *** search
/ Hyper Stacks 1994 May / Hyper Stacks (Pacific HiTech)(1994)[Mac].iso / MacTools / Pennant Fever / background_5617.txt < prev    next >
Text File  |  1989-02-15  |  17KB  |  633 lines

  1. -- background: 5617 from stack: in
  2. -- bmap block id: 3667
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: Team
  6. ----- HyperTalk script -----
  7. function WhichLeague Team
  8. get LeagueOfTeam(Team)
  9. return it
  10. end WhichLeague
  11.  
  12.  
  13.  
  14.  
  15. -- part 16 (field)
  16. -- low flags: 01
  17. -- high flags: 0000
  18. -- rect: left=223 top=234 right=318 bottom=279
  19. -- title width / last selected line: 0
  20. -- icon id / first selected line: 0 / 0
  21. -- text alignment: 65535
  22. -- font id: 3
  23. -- text size: 10
  24. -- style flags: 256
  25. -- line height: 21
  26. -- part name: ClinchDates
  27.  
  28.  
  29. -- part 17 (button)
  30. -- low flags: 00
  31. -- high flags: 8003
  32. -- rect: left=234 top=212 right=228 bottom=324
  33. -- title width / last selected line: 0
  34. -- icon id / first selected line: 0 / 0
  35. -- text alignment: 1
  36. -- font id: 3
  37. -- text size: 10
  38. -- style flags: 256
  39. -- line height: 13
  40. -- part name: Clinch Dates
  41. ----- HyperTalk script -----
  42. on mouseUp
  43.   set cursor to 4
  44.   put the short name of this card into ThisTeam
  45.   put WhichLeague(ThisTeam) into ThisLeague
  46.   if line 1 of field "Teams" is empty then
  47.     put line 2 of field "Teams" into ThatTeam
  48.     put line 2 of field "Magic Number" into CurrentMagicNumber
  49.   else
  50.     put line 1 of field "Teams" into ThatTeam
  51.     put line 1 of field "Magic Number" into CurrentMagicNumber
  52.   end if
  53.   put empty into field "Eliminated"
  54.   set the pattern to 12
  55.   set the lineSize to 1
  56.   get the rect of field "ClinchDates"
  57.   put (item 3 of it) + 10 into X1
  58.   put (item 2 of it) + 13 into Y1
  59.   put 3 into VerticalIncrement
  60.   choose select tool
  61.   drag from (X1-10 & "," & Y1) to (X1+100 & "," & Y1+(3*21)+1)
  62.   doMenu "Fill"
  63.   doMenu "Cut Picture"
  64.   choose browse tool
  65.   if CurrentMagicNumber is "*" then
  66.     put "Already" & return & "Eliminated!" into field "Eliminated"
  67.     put empty into field "ClinchDates"
  68.     put empty into field "ClinchProbVals"
  69.   else
  70.     put DivisionOfTeam(ThisTeam) into ThisDivision
  71.     put word 1 of ThisDivision into League
  72.     put word 1 to 2 of item 2 of field "Date" into CurrentDate
  73.     put "Oct 3" into LastDate
  74.     put CurrentDate & ", 1988" into CurrentDateInSeconds
  75.     convert CurrentDateInSeconds to seconds
  76.     put LastDate & ", 1988" into LastDateInSeconds
  77.     convert LastDateInSeconds to seconds
  78.     put (LastDateInSeconds-CurrentDateInSeconds)/(24*60*60) into NumberOfDates
  79.     repeat with x = 1 to 4
  80.       get LastDateInSeconds - (4-x)*7*24*60*60
  81.       convert it to abbreviated date
  82.       put word 1 to 2 of item 2 of it into line x of field "ClinchDates"
  83.     end repeat
  84.     put "0  .2  .4  .6  .8  1.0" into field "ClinchProbVals"
  85.     ---------------- put 3 into NumberOfDates ----------------
  86.     put CurrentDate & ", 1988" into DateInSeconds
  87.     convert DateInSeconds to seconds
  88.     repeat with x = 1 to NumberOfDates
  89.       put 0.0 into item x of ClinchProbs
  90.       put empty into item x of ClinchDates
  91.     end repeat
  92.     repeat with x = 1 to CurrentMagicNumber+4
  93.       put 0.0 into item x of CurrentDateProbs
  94.     end repeat
  95.     put 1.0 into item CurrentMagicNumber of CurrentDateProbs
  96.     -- here's where you put the preface --
  97.     choose line tool
  98.     repeat with x = 0 to 3
  99.       drag from (X1 & "," & Y1+(3*x*7)) to (X1+100 & "," & Y1+(3*x*7))
  100.       if x<3 then
  101.         get 6
  102.       else
  103.         get 0
  104.       end if
  105.       repeat with y = 0 to it
  106.         put x*7+y into z
  107.         drag from (X1-10 & "," & Y1+(3*z)) to (X1-5 & "," & Y1+(3*z))
  108.       end repeat
  109.     end repeat
  110.     repeat with x = 0 to 5
  111.       drag from (X1+x*20 & "," & Y1) to (X1+x*20 & "," & Y1+(3*21))
  112.     end repeat
  113.     choose select tool
  114.     put (item 1 of line 1 of field "ClinchDates") & ", 1988" into FirstDate
  115.     convert FirstDate to Seconds
  116.     put empty into field "MostProbableClinch"
  117.     put 0.0 into MostProbable
  118.     put 0 into field "TotalClinchProb"
  119.     repeat with NextDate = 1 to NumberOfDates
  120.       add 24*60*60 to DateInSeconds
  121.       put DateInSeconds into DateXX
  122.       convert DateXX to abbreviated date
  123.       put word 1 to 2 of item 2 of DateXX into DateXX
  124.       put GamesOnDate(DateXX,ThisLeague) into DateGames
  125.       -- put DateGames into msg
  126.       put 1.0 into P0
  127.       put 0.0 into P1
  128.       put 0.0 into P2
  129.       put 0.0 into P3
  130.       put 0.0 into P4
  131.       repeat with x = 1 to the number of lines in DateGames
  132.         get line x of DateGames
  133.         -- put it into msg
  134.         if (ThisTeam is in it) and (ThatTeam is in it) then
  135.           put ProbWin(it,ThisTeam) into Q0
  136.           put 0.0 into Q1
  137.           put 1.0-Q0 into Q2
  138.         else if ThisTeam is in it then
  139.           put ProbWin(it,ThisTeam) into Q0
  140.           put 1.0-Q0 into Q1
  141.           put 0.0 into Q2
  142.         else if ThatTeam is in it then
  143.           put ProbLose(it,ThatTeam) into Q0
  144.           put 1.0-Q0 into Q1
  145.           put 0.0 into Q2
  146.         else
  147.           put 1.0 into Q0
  148.           put 0.0 into Q1
  149.           put 0.0 into Q2
  150.         end if
  151.         -- ask "Previous P: " & P0 & "," & P1 & "," & P2
  152.         -- ask "New Q: " & Q0 & "," & Q1 & "," & Q2
  153.         put P4*Q0 + P3*Q1 + P2*Q2 into P4
  154.         put P3*Q0 + P2*Q1 + P1*Q2 into P3
  155.         put P2*Q0 + P1*Q1 + P0*Q2 into P2
  156.         put P1*Q0 + P0*Q1 into P1
  157.         put P0*Q0 into P0
  158.       end repeat
  159.       repeat with x = 1 to CurrentMagicNumber+2
  160.         put item x of CurrentDateProbs into item x of PreviousDateProbs
  161.       end repeat
  162.       get ((P1+P2+P3+P4)*(item 1 of PreviousDateProbs)) + ((P2+P3+P4)*(item 2 of PreviousDateProbs)) + ((P3+P4)*(item 3 of PreviousDateProbs)) + (P4*(item 4 of PreviousDateProbs))
  163.       if (it>0.0) and ((item NextDate of ClinchProbs)=0.0) then
  164.         put it into item NextDate of ClinchProbs
  165.         put it into NonZeroProb
  166.         put DateXX & ", 1988" into NonZeroDate
  167.         add NonZeroProb to field "TotalClinchProb"
  168.         if NonZeroProb>0 then
  169.           if NonZeroProb>MostProbable then
  170.             put NonZeroProb into MostProbable
  171.             put item 1 of NonZeroDate & ": " & (round (NonZeroProb*1000.0))/1000.0 into field "MostProbableClinch"
  172.           end if
  173.           convert NonZeroDate to Seconds
  174.           put (NonZeroDate-FirstDate)/(24*60*60) into DaysAfterFirst
  175.           put Y1+DaysAfterFirst*VerticalIncrement into PlotLineY
  176.           put round(NonZeroProb*100) into PlotLineLength
  177.           if PlotLineLength=0 then put 1 into PlotLineLength
  178.           put X1 & "," & PlotLineY-1 into UpperLeft
  179.           put X1+PlotLineLength & "," & PlotLineY into LowerRight
  180.           drag from UpperLeft to LowerRight
  181.           doMenu "Fill"
  182.         end if
  183.       end if
  184.       put DateXX & ":" & (item NextDate of ClinchProbs) into msg
  185.       repeat with NextNumber = 1 to CurrentMagicNumber
  186.         get (P0*(item NextNumber of PreviousDateProbs)) + (P1*(item NextNumber+1 of PreviousDateProbs)) + (P2*(item NextNumber+2 of PreviousDateProbs)) + (P3*(item NextNumber+3 of PreviousDateProbs)) + (P4*(item NextNumber+4 of PreviousDateProbs))
  187.         put it into item NextNumber of CurrentDateProbs
  188.       end repeat
  189.     end repeat
  190.     hide msg
  191.     choose browse tool
  192.   end if
  193.   put field "Date" into field "Clinch Date"
  194. end mouseUp
  195.  
  196.  
  197.  
  198.  
  199. -- part 18 (field)
  200. -- low flags: 01
  201. -- high flags: 0000
  202. -- rect: left=393 top=272 right=287 bottom=502
  203. -- title width / last selected line: 0
  204. -- icon id / first selected line: 0 / 0
  205. -- text alignment: 65535
  206. -- font id: 3
  207. -- text size: 10
  208. -- style flags: 256
  209. -- line height: 13
  210. -- part name: MostProbableClinch
  211.  
  212.  
  213. -- part 22 (field)
  214. -- low flags: 01
  215. -- high flags: 0000
  216. -- rect: left=414 top=313 right=328 bottom=501
  217. -- title width / last selected line: 0
  218. -- icon id / first selected line: 0 / 0
  219. -- text alignment: 65535
  220. -- font id: 3
  221. -- text size: 10
  222. -- style flags: 256
  223. -- line height: 13
  224. -- part name: TotalClinchProb
  225.  
  226.  
  227. -- part 23 (field)
  228. -- low flags: 01
  229. -- high flags: 4000
  230. -- rect: left=14 top=88 right=201 bottom=92
  231. -- title width / last selected line: 0
  232. -- icon id / first selected line: 0 / 0
  233. -- text alignment: 0
  234. -- font id: 3
  235. -- text size: 12
  236. -- style flags: 0
  237. -- line height: 16
  238. -- part name: Teams
  239.  
  240.  
  241. -- part 24 (field)
  242. -- low flags: 01
  243. -- high flags: 4000
  244. -- rect: left=105 top=88 right=201 bottom=140
  245. -- title width / last selected line: 0
  246. -- icon id / first selected line: 0 / 0
  247. -- text alignment: 65535
  248. -- font id: 3
  249. -- text size: 12
  250. -- style flags: 0
  251. -- line height: 16
  252. -- part name: Wins
  253.  
  254.  
  255. -- part 25 (field)
  256. -- low flags: 01
  257. -- high flags: 4000
  258. -- rect: left=147 top=89 right=202 bottom=182
  259. -- title width / last selected line: 0
  260. -- icon id / first selected line: 0 / 0
  261. -- text alignment: 65535
  262. -- font id: 3
  263. -- text size: 12
  264. -- style flags: 256
  265. -- line height: 16
  266. -- part name: Losses Bold
  267.  
  268.  
  269. -- part 26 (field)
  270. -- low flags: 01
  271. -- high flags: 4000
  272. -- rect: left=200 top=88 right=201 bottom=250
  273. -- title width / last selected line: 0
  274. -- icon id / first selected line: 0 / 0
  275. -- text alignment: 65535
  276. -- font id: 3
  277. -- text size: 12
  278. -- style flags: 256
  279. -- line height: 16
  280. -- part name: Percent Bold
  281.  
  282.  
  283. -- part 29 (field)
  284. -- low flags: 01
  285. -- high flags: 4000
  286. -- rect: left=336 top=88 right=201 bottom=375
  287. -- title width / last selected line: 0
  288. -- icon id / first selected line: 0 / 0
  289. -- text alignment: 65535
  290. -- font id: 3
  291. -- text size: 12
  292. -- style flags: 0
  293. -- line height: 16
  294. -- part name: Games Left
  295.  
  296.  
  297. -- part 30 (field)
  298. -- low flags: 00
  299. -- high flags: 0000
  300. -- rect: left=12 top=32 right=59 bottom=273
  301. -- title width / last selected line: 0
  302. -- icon id / first selected line: 0 / 0
  303. -- text alignment: 0
  304. -- font id: 3
  305. -- text size: 18
  306. -- style flags: 768
  307. -- line height: 24
  308. -- part name: Team
  309.  
  310.  
  311. -- part 31 (field)
  312. -- low flags: 01
  313. -- high flags: 4000
  314. -- rect: left=14 top=88 right=201 bottom=92
  315. -- title width / last selected line: 0
  316. -- icon id / first selected line: 0 / 0
  317. -- text alignment: 0
  318. -- font id: 3
  319. -- text size: 12
  320. -- style flags: 256
  321. -- line height: 16
  322. -- part name: Teams Bold
  323. ----- HyperTalk script -----
  324. on mouseUp
  325.   put LineOfMouseClick("Teams") into WhichLine
  326.   set the cursor to 4
  327.   get line WhichLine of field "Teams"
  328.   if it is empty then get line WhichLine of field "Teams Bold"
  329.   if it is not empty then go to card it
  330. end mouseUp
  331.  
  332.  
  333.  
  334. -- part 32 (field)
  335. -- low flags: 01
  336. -- high flags: 4000
  337. -- rect: left=105 top=88 right=201 bottom=140
  338. -- title width / last selected line: 0
  339. -- icon id / first selected line: 0 / 0
  340. -- text alignment: 65535
  341. -- font id: 3
  342. -- text size: 12
  343. -- style flags: 256
  344. -- line height: 16
  345. -- part name: Wins Bold
  346.  
  347.  
  348. -- part 34 (field)
  349. -- low flags: 01
  350. -- high flags: 4000
  351. -- rect: left=273 top=88 right=201 bottom=300
  352. -- title width / last selected line: 0
  353. -- icon id / first selected line: 0 / 0
  354. -- text alignment: 65535
  355. -- font id: 3
  356. -- text size: 12
  357. -- style flags: 0
  358. -- line height: 16
  359. -- part name: Games Behind
  360.  
  361.  
  362. -- part 35 (field)
  363. -- low flags: 01
  364. -- high flags: 4000
  365. -- rect: left=273 top=88 right=201 bottom=300
  366. -- title width / last selected line: 0
  367. -- icon id / first selected line: 0 / 0
  368. -- text alignment: 65535
  369. -- font id: 3
  370. -- text size: 12
  371. -- style flags: 256
  372. -- line height: 16
  373. -- part name: Games Behind Bold
  374.  
  375.  
  376. -- part 36 (field)
  377. -- low flags: 01
  378. -- high flags: 4000
  379. -- rect: left=299 top=88 right=201 bottom=332
  380. -- title width / last selected line: 0
  381. -- icon id / first selected line: 0 / 0
  382. -- text alignment: 0
  383. -- font id: 3
  384. -- text size: 9
  385. -- style flags: 0
  386. -- line height: 16
  387. -- part name: Games Behind - Half
  388.  
  389.  
  390. -- part 37 (field)
  391. -- low flags: 01
  392. -- high flags: 4000
  393. -- rect: left=299 top=88 right=201 bottom=331
  394. -- title width / last selected line: 0
  395. -- icon id / first selected line: 0 / 0
  396. -- text alignment: 0
  397. -- font id: 3
  398. -- text size: 9
  399. -- style flags: 256
  400. -- line height: 16
  401. -- part name: Games Behind - Half Bold
  402.  
  403.  
  404. -- part 38 (field)
  405. -- low flags: 01
  406. -- high flags: 4000
  407. -- rect: left=336 top=88 right=201 bottom=375
  408. -- title width / last selected line: 0
  409. -- icon id / first selected line: 0 / 0
  410. -- text alignment: 65535
  411. -- font id: 3
  412. -- text size: 12
  413. -- style flags: 256
  414. -- line height: 16
  415. -- part name: Games Left Bold
  416.  
  417.  
  418. -- part 39 (field)
  419. -- low flags: 01
  420. -- high flags: 4000
  421. -- rect: left=147 top=89 right=202 bottom=182
  422. -- title width / last selected line: 0
  423. -- icon id / first selected line: 0 / 0
  424. -- text alignment: 65535
  425. -- font id: 3
  426. -- text size: 12
  427. -- style flags: 0
  428. -- line height: 16
  429. -- part name: Losses
  430.  
  431.  
  432. -- part 40 (field)
  433. -- low flags: 01
  434. -- high flags: 4000
  435. -- rect: left=200 top=88 right=201 bottom=250
  436. -- title width / last selected line: 0
  437. -- icon id / first selected line: 0 / 0
  438. -- text alignment: 65535
  439. -- font id: 3
  440. -- text size: 12
  441. -- style flags: 0
  442. -- line height: 16
  443. -- part name: Percent
  444.  
  445.  
  446. -- part 41 (field)
  447. -- low flags: 01
  448. -- high flags: 4000
  449. -- rect: left=388 top=88 right=201 bottom=423
  450. -- title width / last selected line: 0
  451. -- icon id / first selected line: 0 / 0
  452. -- text alignment: 65535
  453. -- font id: 3
  454. -- text size: 12
  455. -- style flags: 0
  456. -- line height: 16
  457. -- part name: Magic Number
  458. ----- HyperTalk script -----
  459. on mouseUp
  460.   set the cursor to 4
  461.   put the short name of this card into WhichTeam
  462.   repeat with WhichLine = 1 to 7
  463.     if line WhichLine of field "Teams Bold" is WhichTeam
  464.     then put WhichLine into TeamLine
  465.   end repeat
  466.   put (the number of lines in field "Teams") into MaxTeam
  467.   if TeamLine > MaxTeam then put TeamLine into MaxTeam
  468.   repeat with WhichLine = 1 to MaxTeam
  469.     if WhichLine is TeamLine then
  470.       put line WhichLine of field "Games Left Bold" into GamesLeft
  471.       put line WhichLine of field "Wins Bold" into Wins
  472.       put line WhichLine of field "Losses Bold" into Losses
  473.     else if line WhichLine of field "Teams" is not empty then
  474.       put line WhichLine of field "Games Left" into GamesLeft
  475.       put line WhichLine of field "Wins" into Wins
  476.       put line WhichLine of field "Losses" into Losses
  477.     end if
  478.     put GamesLeft into item WhichLine of AllGamesLeft
  479.     put Wins-Losses into item WhichLine of AllDifferences
  480.     if line WhichLine of field "Teams" is empty then
  481.       put item WhichLine of AllDifferences into ThisDifference
  482.       put item WhichLine of AllGamesLeft into ThisGamesLeft
  483.     end if
  484.   end repeat
  485.   put empty into field "Magic Number"
  486.   repeat with WhichLine = 1 to MaxTeam
  487.     put item WhichLine of AllDifferences into WinLossDifference
  488.     put item WhichLine of AllGamesLeft into GamesLeft
  489.     get ThisGamesLeft+GamesLeft+WinLossDifference-ThisDifference
  490.     put (it/2)+1 into MagicNumber
  491.     if MagicNumber > (GamesLeft+ThisGamesLeft)
  492.     then put "*" into MagicNumber
  493.     if line WhichLine of field "Teams" is empty
  494.     then put "--" into MagicNumber
  495.     put MagicNumber into line WhichLine of field "Magic Number"
  496.   end repeat
  497. end mouseUp
  498.  
  499.  
  500.  
  501. -- part 42 (field)
  502. -- low flags: 01
  503. -- high flags: 0000
  504. -- rect: left=373 top=229 right=244 bottom=507
  505. -- title width / last selected line: 0
  506. -- icon id / first selected line: 0 / 0
  507. -- text alignment: 65535
  508. -- font id: 3
  509. -- text size: 10
  510. -- style flags: 256
  511. -- line height: 13
  512. -- part name: Clinch Date
  513.  
  514.  
  515. -- part 44 (field)
  516. -- low flags: 01
  517. -- high flags: 4000
  518. -- rect: left=345 top=30 right=47 bottom=500
  519. -- title width / last selected line: 0
  520. -- icon id / first selected line: 0 / 0
  521. -- text alignment: 0
  522. -- font id: 3
  523. -- text size: 12
  524. -- style flags: 768
  525. -- line height: 16
  526. -- part name: Date
  527.  
  528.  
  529. -- part 49 (button)
  530. -- low flags: 00
  531. -- high flags: 8003
  532. -- rect: left=11 top=311 right=328 bottom=58
  533. -- title width / last selected line: 0
  534. -- icon id / first selected line: 0 / 0
  535. -- text alignment: 1
  536. -- font id: 21
  537. -- text size: 10
  538. -- style flags: 256
  539. -- line height: 13
  540. -- part name: Browse
  541. ----- HyperTalk script -----
  542. on mouseUp
  543.   go to card "Index"
  544. end mouseUp
  545.  
  546.  
  547.  
  548.  
  549. -- part 50 (button)
  550. -- low flags: 00
  551. -- high flags: 0000
  552. -- rect: left=117 top=307 right=330 bottom=139
  553. -- title width / last selected line: 0
  554. -- icon id / first selected line: 15420 / 15420
  555. -- text alignment: 1
  556. -- font id: 0
  557. -- text size: 12
  558. -- style flags: 0
  559. -- line height: 16
  560. -- part name: GoToPrev
  561. ----- HyperTalk script -----
  562. on mouseUp
  563.   go to previous card
  564. end mouseUp
  565.  
  566.  
  567.  
  568. -- part 51 (button)
  569. -- low flags: 00
  570. -- high flags: 0000
  571. -- rect: left=144 top=306 right=331 bottom=168
  572. -- title width / last selected line: 0
  573. -- icon id / first selected line: 16560 / 16560
  574. -- text alignment: 1
  575. -- font id: 0
  576. -- text size: 12
  577. -- style flags: 0
  578. -- line height: 16
  579. -- part name: GoToPrev
  580. ----- HyperTalk script -----
  581. on mouseUp
  582.   go to next card
  583. end mouseUp
  584.  
  585.  
  586.  
  587. -- part 52 (button)
  588. -- low flags: 00
  589. -- high flags: 8003
  590. -- rect: left=62 top=311 right=328 bottom=109
  591. -- title width / last selected line: 0
  592. -- icon id / first selected line: 0 / 0
  593. -- text alignment: 1
  594. -- font id: 21
  595. -- text size: 10
  596. -- style flags: 256
  597. -- line height: 13
  598. -- part name: Help
  599. ----- HyperTalk script -----
  600. on mouseUp
  601.   go to card "Help"
  602. end mouseUp
  603.  
  604.  
  605.  
  606.  
  607. -- part 53 (field)
  608. -- low flags: 01
  609. -- high flags: 0000
  610. -- rect: left=268 top=251 right=299 bottom=368
  611. -- title width / last selected line: 0
  612. -- icon id / first selected line: 0 / 0
  613. -- text alignment: 1
  614. -- font id: 3
  615. -- text size: 12
  616. -- style flags: 768
  617. -- line height: 16
  618. -- part name: Eliminated
  619.  
  620.  
  621. -- part 54 (field)
  622. -- low flags: 00
  623. -- high flags: 0000
  624. -- rect: left=280 top=316 right=332 bottom=402
  625. -- title width / last selected line: 0
  626. -- icon id / first selected line: 0 / 0
  627. -- text alignment: 0
  628. -- font id: 3
  629. -- text size: 10
  630. -- style flags: 256
  631. -- line height: 13
  632. -- part name: ClinchProbVals
  633.